﻿using System;
using System.Linq;
using Microsoft.Practices.Prism.Modularity;
using Microsoft.Practices.Prism.Regions;
using Microsoft.Practices.Unity;
using Mipic.Infrastructure;
using Mipic.Modules.Interactions.Views;

namespace Mipic.Modules.Interactions
{
    public class InteractionModule : IModule
    {
        
        #region //--------- Private Fields --------------//
        
        private readonly IRegionManager _regionManager;
        private readonly IUnityContainer _container;
        
        #endregion
        
        #region //--------- Public Constructors ---------//
        
        public InteractionModule(IUnityContainer container, IRegionManager regionManager)
        {
            _regionManager = regionManager;
            _container = container;
        }
        
        #endregion
        
        #region //--------- Interface Members -----------//
        
        /// <summary>
        /// Notifies the module that it has be initialized.
        /// </summary>
        public void Initialize()
        {
            _regionManager.Regions[RegionNames.MainRegionName].Add(_container.Resolve<ConfigurationView>());
        }

        #endregion

    }
}